<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ include file="common.jsp" %>
<html>
<head>
    <title>Admin Dashboard</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            margin: 0;
            padding: 0;
            background-color: #f0f2f5;
        }

        .container {
            display: flex;
            flex-direction: column;
            height: 100vh;
        }

        .header {
            background-color: #343a40; /* 深灰色背景 */
            color: white;
            padding: 20px;
            text-align: center;
        }

        .header h1 {
            margin: 0;
        }

        .main-content {
            display: flex;
            flex: 1;
        }

        .side {
            background-color: #343a40;
            color: white;
            padding: 20px;
            width: 160px; /* 保持侧边栏宽度为160px */
            height: 100%;
            box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
        }

        .side a {
            color: white;
            text-decoration: none;
            display: block;
            margin: 0 0;
        }

        .side a:hover {
            text-decoration: underline;
        }

        .main {
            flex: 1;
            padding: 20px;
            overflow-y: auto;
        }

        .card {
            margin-bottom: 20px;
            padding: 20px;
            border: 1px solid #dee2e6;
            border-radius: 4px;
            background-color: white;
            transition: 0.3s;
        }

        .card:hover {
            box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
        }

        .card-title {
            font-size: 24px;
            margin-bottom: 10px;
        }

        .card-content {
            font-size: 16px;
            line-height: 1.6;
        }

        .footer {
            background-color: #343a40; /* 深灰色背景 */
            color: white;
            text-align: center;
            padding: 10px 0;
        }
    </style>
</head>
<body>

<div class="container">
    <!-- 头部 -->
    <div class="header">
        <h1>信息后台</h1>
    </div>

    <div class="main-content">
        <!-- 侧边栏 -->
        <div class="side">
            <c:forEach var="menu" items="${menuItems}">
                <a href="#" onclick="loadContent('${menu.page}')">${menu.name}</a>
            </c:forEach>
        </div>

        <!-- 主内容区 -->
        <div class="main" id="main-content">
            <div class="card" id="default-card">
                <h2 class="card-title">Hello World</h2>
            </div>
        </div>
    </div>

    <!-- 页脚 -->
    <div class="footer">
        <p>&copy; 2024 Your Company. All rights reserved.</p>
    </div>
</div>

<script>
    function loadContent(page) {
        var mainContent = document.getElementById('main-content');
        mainContent.innerHTML = ''; // 清空当前内容

        var iframe = document.createElement('iframe');
        iframe.src = page;
        iframe.style.width = '100%';
        iframe.style.height = '100%';
        iframe.style.border = 'none';

        mainContent.appendChild(iframe);
    }
</script>

</body>
</html>
